<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Vue中多个元素的过渡</title>
  <script src="vue.js"></script>
  <script src="velocity.min.js"></script>
  <link rel="stylesheet" href="css/animate.css">
  <style>
      .fade-enter,.fade-leave-to{
        opacity: 0;
      }
      .fade-enter-active,.fade-leave-active{
        transition:opacity 1s;
      }
  </style>
</head>
<body>
<!--mode参数属性可改变多个元素的过渡效果in-out  and  out-in-->
<!--transition标签内两个DOM元素的切换容易复用DOM导致看不到动画效果-->
<!--解决办法使用key="随意"-->
<div id="app">
  <transition name="fade" mode="out-in">
    <div v-if="show" key="hello">hello world</div>
    <div v-else key="Bye">Bye world</div>
  </transition>
  <button @click="handelBtnClick">change</button>
</div>
<script>
  var vm=new Vue({
    el:"#app",
    data:{
      show:true,
    },
    methods:{
      handelBtnClick:function(){
        this.show=!this.show
      }
    }
  })
</script>
</body>
</html>
